package
{
	import com.events.Events;
	
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.text.TextField;
	import flash.text.TextFieldType;
	import flash.utils.clearInterval;
	import flash.utils.setInterval;
	
	public class mymethod extends Sprite
	{
		private var id:int;
		private var num:int = 1000;
		private var txt1:TextField;
		private var txt2:TextField;
		
		public function mymethod()
		{
			txt1 = new TextField();
			addChild(txt1);
			txt2 = new TextField();
			addChild(txt2);
			txt2.y = 50;
			txt2.addEventListener(Events.CHANGE,test);
			
			id = setInterval(repeating,1000);
		}
		
		private function repeating():void
		{
			txt1.text = String(num);
			txt2.dispatchEvent(new Events(Events.CHANGE,num));
			num--;
			if(num==0)
				clearInterval(id);
		}
		
		private function test(e:Events):void
		{
			txt2.text = e.i;
			trace(e.i);
		}
	}
}